Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import base64
|
|
6 |
import time
|
7 |
import os
|
8 |
import google.generativeai as genai
|
|
|
9 |
|
10 |
import pathlib
|
11 |
|
@@ -56,7 +57,23 @@ def app1_response(img):
|
|
56 |
img = PIL.Image.open(img)
|
57 |
response = vis_model.generate_content([txt_prompt_1,img])
|
58 |
return response.text
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
def app2_response(text):
|
61 |
resp = text + """
|
62 |
=======
|
@@ -87,7 +104,7 @@ with gr.Blocks() as app1:
|
|
87 |
out2 = gr.Textbox(label="from SMS gateway...")
|
88 |
|
89 |
btn1.click(fn=app1_response, inputs=[image_box], outputs=out1)
|
90 |
-
btn2.click(fn=
|
91 |
|
92 |
gr.Markdown("""
|
93 |
# Make a Plan #
|
|
|
6 |
import time
|
7 |
import os
|
8 |
import google.generativeai as genai
|
9 |
+
import requests
|
10 |
|
11 |
import pathlib
|
12 |
|
|
|
57 |
img = PIL.Image.open(img)
|
58 |
response = vis_model.generate_content([txt_prompt_1,img])
|
59 |
return response.text
|
60 |
+
|
61 |
+
def send_SMS(resp_text)
|
62 |
+
url = "https://sms.api.sinch.com/xms/v1/b3af1b4a38cd47708c26c9d940492748/batches"
|
63 |
+
headers = {
|
64 |
+
"Authorization": "Bearer 43eb78f13b6f4ec784d6a94439958d30",
|
65 |
+
"Content-Type": "application/json"
|
66 |
+
}
|
67 |
+
|
68 |
+
data = {
|
69 |
+
"from": "12085686834",
|
70 |
+
"to": ["18587331029"],
|
71 |
+
"body": resp_text
|
72 |
+
}
|
73 |
+
|
74 |
+
response = requests.post(url, json=data, headers=headers)
|
75 |
+
return response.text
|
76 |
+
|
77 |
def app2_response(text):
|
78 |
resp = text + """
|
79 |
=======
|
|
|
104 |
out2 = gr.Textbox(label="from SMS gateway...")
|
105 |
|
106 |
btn1.click(fn=app1_response, inputs=[image_box], outputs=out1)
|
107 |
+
btn2.click(fn=send_SMS, inputs=out1, outputs=out2)
|
108 |
|
109 |
gr.Markdown("""
|
110 |
# Make a Plan #
|