Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -43,7 +43,7 @@ GOOGLE_API_KEY = os.environ.get('GOOGLE_API_KEY')
|
|
43 |
genai.configure(api_key=GOOGLE_API_KEY)
|
44 |
model = genai.GenerativeModel('gemini-2.0-flash')
|
45 |
|
46 |
-
static_tmp_path = "/tmp
|
47 |
os.makedirs(static_tmp_path, exist_ok=True)
|
48 |
|
49 |
# API_URL = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1"
|
@@ -112,7 +112,7 @@ def handle_content_message(event):
|
|
112 |
dist_path = tempfile_path + '.' + ext
|
113 |
dist_name = os.path.basename(dist_path)
|
114 |
os.rename(tempfile_path, dist_path)
|
115 |
-
|
116 |
|
117 |
with ApiClient(configuration) as api_client:
|
118 |
line_bot_api = MessagingApi(api_client)
|
@@ -121,7 +121,7 @@ def handle_content_message(event):
|
|
121 |
reply_token=event.reply_token,
|
122 |
messages=[
|
123 |
TextMessage(text='Save content.'),
|
124 |
-
TextMessage(text=
|
125 |
# TextMessage(text=request.host_url + os.path.join('static', 'tmp', dist_name))
|
126 |
]
|
127 |
)
|
|
|
43 |
genai.configure(api_key=GOOGLE_API_KEY)
|
44 |
model = genai.GenerativeModel('gemini-2.0-flash')
|
45 |
|
46 |
+
static_tmp_path = "/tmp"
|
47 |
os.makedirs(static_tmp_path, exist_ok=True)
|
48 |
|
49 |
# API_URL = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1"
|
|
|
112 |
dist_path = tempfile_path + '.' + ext
|
113 |
dist_name = os.path.basename(dist_path)
|
114 |
os.rename(tempfile_path, dist_path)
|
115 |
+
uploaded_image = imgur_client.upload_image(dist_path, title="上傳測試")
|
116 |
|
117 |
with ApiClient(configuration) as api_client:
|
118 |
line_bot_api = MessagingApi(api_client)
|
|
|
121 |
reply_token=event.reply_token,
|
122 |
messages=[
|
123 |
TextMessage(text='Save content.'),
|
124 |
+
TextMessage(text=uploaded_image)
|
125 |
# TextMessage(text=request.host_url + os.path.join('static', 'tmp', dist_name))
|
126 |
]
|
127 |
)
|