Spaces:
Runtime error
Runtime error
Goodsea
commited on
Commit
·
9f2d1fe
1
Parent(s):
eccb5ee
lint codebase
Browse files- app.py +2 -2
- db_utils.py +3 -1
- openai_api.py +2 -1
app.py
CHANGED
|
@@ -34,7 +34,7 @@ def save_deta_db(input):
|
|
| 34 |
|
| 35 |
|
| 36 |
def update_component():
|
| 37 |
-
return gr.update(value="
|
| 38 |
|
| 39 |
|
| 40 |
def clear_textbox(value):
|
|
@@ -118,7 +118,7 @@ with gr.Blocks() as demo:
|
|
| 118 |
|
| 119 |
with gr.Column():
|
| 120 |
text_area = gr.TextArea(label="Metin yükleyin 👇 ")
|
| 121 |
-
text_area_button = gr.Button(value=
|
| 122 |
open_api_text = gr.Textbox(label="Tam Adres")
|
| 123 |
run_button = gr.Button(value="Veriyi İşle")
|
| 124 |
with gr.Column():
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
def update_component():
|
| 37 |
+
return gr.update(value="Gönderildi, teşekkürler.", visible=True)
|
| 38 |
|
| 39 |
|
| 40 |
def clear_textbox(value):
|
|
|
|
| 118 |
|
| 119 |
with gr.Column():
|
| 120 |
text_area = gr.TextArea(label="Metin yükleyin 👇 ")
|
| 121 |
+
text_area_button = gr.Button(value="Metni Yükle", label="Submit")
|
| 122 |
open_api_text = gr.Textbox(label="Tam Adres")
|
| 123 |
run_button = gr.Button(value="Veriyi İşle")
|
| 124 |
with gr.Column():
|
db_utils.py
CHANGED
|
@@ -6,6 +6,7 @@ deta_key = os.getenv("DETA_KEY")
|
|
| 6 |
deta = Deta(deta_key)
|
| 7 |
db = deta.Base("deprem-ocr")
|
| 8 |
|
|
|
|
| 9 |
def get_users_by_city(city_name, limit=10):
|
| 10 |
|
| 11 |
user = db.fetch({"city": city_name.capitalize()}, limit=limit).items
|
|
@@ -31,7 +32,8 @@ def write_db(data_dict):
|
|
| 31 |
# 3) create and use as many DBs as you want!
|
| 32 |
users = deta.Base("deprem-ocr")
|
| 33 |
users.insert(data_dict)
|
| 34 |
-
print(
|
|
|
|
| 35 |
|
| 36 |
def get_latest_row(last):
|
| 37 |
all_items = get_all()
|
|
|
|
| 6 |
deta = Deta(deta_key)
|
| 7 |
db = deta.Base("deprem-ocr")
|
| 8 |
|
| 9 |
+
|
| 10 |
def get_users_by_city(city_name, limit=10):
|
| 11 |
|
| 12 |
user = db.fetch({"city": city_name.capitalize()}, limit=limit).items
|
|
|
|
| 32 |
# 3) create and use as many DBs as you want!
|
| 33 |
users = deta.Base("deprem-ocr")
|
| 34 |
users.insert(data_dict)
|
| 35 |
+
print("Pushed to db")
|
| 36 |
+
|
| 37 |
|
| 38 |
def get_latest_row(last):
|
| 39 |
all_items = get_all()
|
openai_api.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import openai
|
| 2 |
import os
|
| 3 |
|
|
|
|
| 4 |
class OpenAI_API:
|
| 5 |
def __init__(self):
|
| 6 |
self.openai_api_key = ""
|
|
@@ -15,7 +16,7 @@ class OpenAI_API:
|
|
| 15 |
response = openai.Completion.create(
|
| 16 |
engine="Davinci-003",
|
| 17 |
prompt=address_text,
|
| 18 |
-
temperature=0
|
| 19 |
max_tokens=500,
|
| 20 |
top_p=1,
|
| 21 |
# n=1,
|
|
|
|
| 1 |
import openai
|
| 2 |
import os
|
| 3 |
|
| 4 |
+
|
| 5 |
class OpenAI_API:
|
| 6 |
def __init__(self):
|
| 7 |
self.openai_api_key = ""
|
|
|
|
| 16 |
response = openai.Completion.create(
|
| 17 |
engine="Davinci-003",
|
| 18 |
prompt=address_text,
|
| 19 |
+
temperature=0.0,
|
| 20 |
max_tokens=500,
|
| 21 |
top_p=1,
|
| 22 |
# n=1,
|