https://docs.beeware.org/en/latest/tutorial/tutorial-0.html

 

Tutorial 0 - Let’s get set up! - BeeWare Tutorial

Previous Home

docs.beeware.org

여기를 참고합니다. Linux platform을 기준으로 설명합니다.

 

 

Update and install dependencies

sudo apt-get update
sudo apt-get install build-essential git python3-dev python3-venv python3-cairo-dev python3-gi-cairo libgirepository1.0-dev libcairo2-dev libpango1.0-dev gir1.2-webkit2-4.0 pkg-config

Update도 dependency 설치도 실패. (일단 현재 설치된 package로 시도해 봅니다.)

 

 

Beeware 설치

pip install briefcase

 

First project

briefcase new

Project를 생성하면, 다음과 같은 항목들을 물어봅니다. 'Hello World' 예제를 만들고 싶으면 대부분 enter를 칩니다.

cd helloworld
briefcase dev

'briefcase dev' 를 실행하는 동안 toga-gtk package를 설치하는데, error가 나서 실행을 중단합니다.

아마도 이전에 dependencies를 설치하다 실패했기 때문인듯 합니다.

 

차후, 해결방법을 찾으면 다시 이어서 진행하도록 합니다.

설치가 어려우면 사용도 쉽지 않을텐데...

sudo apt install libcairo2 libcairo2-dev

sudo apt install libgirepository1.0-dev

드디어, helloworld가 시작되나 했는데, 

sudo apt-get install libgtk-3-dev

virtualenv 폴더에서 .../X11/xkb 가 발견되지 않습니다. 대신, /usr/share/X11/xkb 는 아래 command로 설치가 된듯합니다.

원래 있었는지, 새로 설치가 된건지는 알수 없지만, virtualenv 같은 위치에 symlink를 만들어 주니, 화면이 정상적으로 뜹니다.

sudo apt install -y libxkbcommon-x11-dev

ln -s /usr/share/X11/  ~/miniconda3/envs/bee-env/share/

 

인고의 시간 끝에 겨우 창문하나 띄웠습니다.

(Kivy는 아직 설치도 안된거에 비하면 다행인건가?

 

Android package 만들기

Project folder에서

briefcase create android
briefcase build android

명령을 수행하면서 필요한 package들을 설치하고, 작업이 완료되면 apk 파일 위치를 print 해줍니다.

briefcase create and build android

 

반응형

CharGPT를 사용하는 chatbot을 만들기는 했지만, API 사용료가 있다보니, 부담스러워서 사용하기가 꺼려지네요.

개인적으로 사용하고, 수익이 있는 앱이 아니다 보니, 무료 API engine을 찾게 되었고, google Bard가 마침 비슷한 기능을 하고 있어서, 시험해 보기로 합니다.

기존에 만든 JavisBot with ChatGPT project를 복사해서, curl request오 json reponse parsing을 바꿔볼 생각입니다.

 

Google Bard API link

https://github.com/ra83205/google-bard-api

 

GitHub - ra83205/google-bard-api: This project provides a FastAPI wrapper for interacting with Google Bard, a conversational AI

This project provides a FastAPI wrapper for interacting with Google Bard, a conversational AI by Google. It allows users to send messages to Google Bard and receive responses through a simple API. ...

github.com

 

BardAPI를 사용하여 응답 읽어오기 (Link에 사용법을 참고했습니다.)

https://yeko90.tistory.com/entry/%EB%B0%94%EB%93%9C-api-%EC%82%AC%EC%9A%A9%EB%B2%95

 

구글 바드(google bard) API사용법(무료)

챗gpt api에 이어 드디어 바드 api를 사용할 수 있게 되었다. 물론 정식으로 구글이 제공하는 api는 아니다. 하지만 api기능으로 더할 나위 없이 훌륭하여 소개한다. 참고 : 실습은 코랩 환경에서 진

yeko90.tistory.com

1. bardapi 설치

2. API_KEY 복사

3. python test

 

1. bardapi 설치

pip install bardapi

2. API_KEY 복사

https://bard.google.com/ 접속, ->  F12

'__Secure-1PSID' 값을 복사

 

3. Python test

import bardapi
import os

# input api_key 
os.environ['_BARD_API_KEY']="Enter Your API_KEY here"

input_text="Who is Korean president?"
response = bardapi.core.Bard().get_answer(input_text)

for i, choice in enumerate (response['choices']):
    print (f"Choice {i+1}: \n", choice['content'][0], "\n")

API KEY가 모두 같은지, 개인 계정에 따라 달라지는지 모르겠네요.

code를 실행하면, 다음과 같은 답변을 줍니다.

반응형

'Android App 만들기 > App Inventor' 카테고리의 다른 글

JavisBot with ChatGPT API  (0) 2023.06.05
ChatGPT API 호출하기  (0) 2023.06.04
How to start  (0) 2023.06.03

AI 스피커와 유사한 형태로 동작하는  chat bot을 ChatGPT API를 사용하여, App Inventor로 구현하는 방법입니다.

완성된 Design view와 Blocks 구성을 보면 

Design view

Blocks

 

초기 의도와는 다르게 코드 구성이 조금 더 복잡해진 감이 있습니다.

 

 

https://www.youtube.com/watch?v=rFUSqn1uzWA 

동영상을 참조하면, App Inventor를 이용해서 chantbot을 만드는 과정을 자세히 알려줍니다.

 

제경우에는 App Inventor로 기능을 구현시에 API KEY를 사용하여 request를 생성하는 부분과, 

json type으로 반환되는 respons result를 parsing하는 작업에서 동영상처럼 되지 않아 고생을 했습니다.

두가지 process에 대해 따로 diagram을 보면 다음과 같이 나옵니다.

request data 
respons result parsing

request Header 및 data는 ChatGPT model에 따라 다른것 같습니다. gpt-3.5-turbo로는 결과를 확인 했는데, text-davinci-002(003?) model 에서는 다른 방식으로 data를 구성해야 하나 봅니다.

 

respons result는 json type으로 받아오는데, key 값으로 찾는 방법을 잘 몰라서, 처리된 결과를 하나씩 보고, array와 dictionary를 조합해서 겨우 만들었어요...

 

App Inventor로 처음 스마트폰 앱을 만들어 보고 느낀점은 Android studio 같은 방식의 IDE를 사용하는 것 보다 훨씬 쉽구나.. 다른 app도 만들어 볼 수 있겠다.

반응형

'Android App 만들기 > App Inventor' 카테고리의 다른 글

JavisBot with Google Bard API  (0) 2023.06.05
ChatGPT API 호출하기  (0) 2023.06.04
How to start  (0) 2023.06.03

OpenAI api-reference page를 참조하면, 자세한 설명을 찾을 수 있습니다.

https://platform.openai.com/docs/api-reference/introduction

 

OpenAI API

An API for accessing new AI models developed by OpenAI

platform.openai.com

 

Model list를 받아오는 예제

curl command를사용하는 방법

curl https://api.openai.com/v1/models \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Organization: org-81Wx20CO6Q3YYhaBk9cIt276"

 

Python을 사용하는 방법

import os
import openai
openai.organization = "org-81Wx20CO6Q3YYhaBk9cIt276"
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Model.list()

 

 Node.js 를 사용하는 방법

import { Configuration, OpenAIApi } from "openai";
const configuration = new Configuration({
    organization: "org-81Wx20CO6Q3YYhaBk9cIt276",
    apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.listEngines();

 

 

Sample request 사용하는 방법

curl command를 사용하는 방법

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
     "model": "gpt-3.5-turbo",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'

위와 같은 sample request에 다음과 같은 응답이 오면 됩니다.

{
   "id":"chatcmpl-abc123",
   "object":"chat.completion",
   "created":1677858242,
   "model":"gpt-3.5-turbo-0301",
   "usage":{
      "prompt_tokens":13,
      "completion_tokens":7,
      "total_tokens":20
   },
   "choices":[
      {
         "message":{
            "role":"assistant",
            "content":"\n\nThis is a test!"
         },
         "finish_reason":"stop",
         "index":0
      }
   ]
}

 

App Inventor에 적용하기

curl command를 사용하여 scratch block을 구성하는 방법입니다.

https://community.appinventor.mit.edu/t/u-parameter-curl-to-http-request/62516/2

 

-u Parameter cURL to HTTP Request

Use the block call web request headers and make a list block Also use this site to convert curl to block

community.appinventor.mit.edu

model list를 받아오는 예제에 대하여 block을 만들어 봅니다.

curl https://api.openai.com/v1/models \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Organization: org-81Wx20CO6Q3YYhaBk9cIt276"

이런 식으로 block을 구성합니다.

 

 

Convert cURL request to Blocks

curl dommand를 scratch block으로 변환해 주는 site가 있네요.

https://getaix.com/curl-to-blocks

 

Getaix marketplace

Largest extension marketplace for exploring and publishing extensions for AppInventor and it's clones.

getaix.com

 

site에 접속해서 curl command를 입력하면, procedure block으로 변환을 해주고, 필요한 부분만 일부 수정해서 사용할 수 있습니다.

Mouse를 block image에 올리면 download button이 뜨는데, image로 down 받아서 App Inventor에서 Blocks 창에서 'Upload file'로 불러오면 바로 적용이 가능합니다.

반응형

'Android App 만들기 > App Inventor' 카테고리의 다른 글

JavisBot with Google Bard API  (0) 2023.06.05
JavisBot with ChatGPT API  (0) 2023.06.05
How to start  (0) 2023.06.03

http://appinventor.mit.edu/

 

MIT App Inventor

An Overview of the App Inventor Sources -- Components Read about how the App Inventor sources are structured in this series of blog posts. This week we discuss the App Inventor components module. More

appinventor.mit.edu

MIT App Inventor는 Google이 만들었고, MIT 에서 관리를 하고 있다고 합니다.

 

App Inventor는 web base로 동작하기 때문에 별도의 설치 과정이 필요없습니다.

 

Google 계정으로 간단하게 가입할 수 있고, Beginner를 위한 설명이 잘 되어 있어 누구나 쉽게 시작할 수 있습니다.

프로그래밍 방식은 Sketch를 사용합니다. 기본적인 프로그래밍 경험이 있다면, 쉽게 사용할 수 있습니다.

처음 사용해 보지만, 익숙해 지는데 오래 걸리지 않네요.

처음 사용한다면, Get Started, Try a Turorial을 꼼꼼히 읽어 보세요. 반드시 도움이 됩니다.

반응형

'Android App 만들기 > App Inventor' 카테고리의 다른 글

JavisBot with Google Bard API  (0) 2023.06.05
JavisBot with ChatGPT API  (0) 2023.06.05
ChatGPT API 호출하기  (0) 2023.06.04

예전부터 집사람이 아이언맨에 나오는 자비스 만들수 없냐는 질문을 자주 하곤 했습니다.

"당근, 어렵지!" 라는 대답만 해왔었는데, 최근 ChatGPT가 뜨고, API를 사용할 수 있다는 얘기를 듣고는 생각이 좀 달라졌습니다.

OpenAI에 ChatGPT의 대답은 JAVIS 뺨치는 정도(?)라고 생각합니다. 개인차는 있겠지만...

SK NUGU나 Kakao AI speaker와 같은 모양은 아직 부담스러워서, 핸드폰 앱으로 시작해 보려고 합니다.

아주 예전에 사진을 16조각으로 나누어서 퍼즐 맞추는 앱을 만든게 다인데, 요즘에는 앱 만드는게 더 어려워 진거 같아요.

시간도 많지는 않고... 흠흠.

사이버대학 수업을 이것저것 듯고 있는데, 마침 앱인벤터에 대한 강좌가 있었습니다.

별도의 코딩도 많지 않은거 같고, 무거운 빌드 환경도 필요없는것 같아 시작해보고 있습니다.

대안으로는 Python으로 앱을 만들수도 있는데, 'python android app' 이라고만 쳐도 다양한 링크가 나옵니다.

Kivy 나 Pydroid 3가 제일먼저 눈에 들어오네요.

MIT App inventor가 예상보다 쉽지 않을 경우, python으로 갈아 타보려고 합니다.

반응형

'DIY' 카테고리의 다른 글

Dial 운동화 수리  (0) 2023.07.12
물리 엔진 사용해 보기  (0) 2023.05.29
DoorLock 기어 고장 수리  (0) 2023.05.18
DTV 안테나 만들기  (0) 2022.11.12

 

Download Unity

 

https://store.unity.com/download?check_logged_in=1 

 

Download Unity

Unity is the ultimate real-time 2D, 3D, AR, & VR development engine. Download Unity to start creating today and get access to the Unity platform and ecosystem.

store.unity.com

Unity personal download site에서 Unity Hub를 download 받습니다.

 

Download된 'UnityHubSetup.exe' 파일을 실행하면, 설치가 시작됩니다.

- 계정을 생성하고, personal use에 대한 license를 check해 줍니다.

- 5GB 정도의 설치 공간이 필요합니다.

 

Unity를 실행합니다.

'New Project' 선택

'2D Platformer Microgame'에 'Download template' 선택

기본 tutorial을 시작하면서 간단한 조작법을 알려줍니다.

Player나 token, slime 등의 크기, 위치를 변경할 수 있고, map을 바꿔 볼 수도 있습니다.

 

 

반응형

'DIY' 카테고리의 다른 글

Dial 운동화 수리  (0) 2023.07.12
Javis 만들자 - 어떻게 시작하지?  (0) 2023.06.01
DoorLock 기어 고장 수리  (0) 2023.05.18
DTV 안테나 만들기  (0) 2022.11.12

https://www.youtube.com/watch?v=IKkw4d7jyu0

radial vector reducer 로 검색

https://www.mdpi.com/2076-3417/12/14/7003 이런 문서를 찾아서 설명해줍니다. (대충 넘기는데 무슨 말인지 모름)

 

Cycloidal gear print에서 Gear 부품은 다 출력했기 때문에 bearing과 나사 + 나사 mount 등이 필요합니다.

 

15x24x5 bearing

  https://amzn.to/3ipHO4C

M5x50 cap screw

  https://amzn.to/3gPBIdG

20x27x4 bearing

  https://amzn.to/3VI7A91

M5 Nylock Nut

  https://amzn.to/3XCIqEp

45x58x7 bearing

  https://amzn.to/3AYoaFz

M3 cap screws

  https://amzn.to/3uhHdVj
Heat stake inserts

  https://amzn.to/3H5FQka
M5x12 button head screw   https://amzn.to/3GXD94j 

표 안에 그림을 넣고 싶었는데, 방법을 모르겠네요... ㅜㅜ

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

반응형

'Robot > Cycloidal Gear' 카테고리의 다른 글

Cycloidal GearBox 조립순서  (0) 2023.06.18
Cycloidal Gearbox 만들기  (0) 2023.05.22

+ Recent posts