keremberke commited on
Commit
16d8d96
1 Parent(s): d698b16

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +2 -7
  2. gpt_utils.py +1 -0
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import dotenv
3
  import os
4
  from gpt_utils import update_text_with_ai
5
- from db_utils import supabase, get_next_row_id, get_text_by_row_id
6
 
7
  dotenv.load_dotenv()
8
  PW=os.getenv("PW")
@@ -11,11 +11,6 @@ def apply_ai_func(text, request: gr.Request):
11
  updated_text2 = update_text_with_ai(text)
12
  return updated_text2
13
 
14
- def add_to_db_func(text, request: gr.Request):
15
- #data, count = supabase.table('eso-tr').update({'updated_text': text}).eq('id', 1).execute()
16
-
17
-
18
- pass
19
 
20
  def get_next_func(request: gr.Request):
21
  next_id = get_next_row_id(user_name=request.username)
@@ -33,6 +28,6 @@ with gr.Blocks(analytics_enabled=False) as demo:
33
 
34
  get_from_db.click(fn=get_next_func, outputs=[text_id, original_text])
35
  apply_ai.click(fn=apply_ai_func, inputs=original_text, outputs=updated_text)
36
- add_to_db.click(fn=add_to_db_func, inputs=updated_text)
37
 
38
  demo.launch(auth=[("kerem", PW), ("mehmet", PW)],favicon_path="./tugra_logo.png")
 
2
  import dotenv
3
  import os
4
  from gpt_utils import update_text_with_ai
5
+ from db_utils import supabase, get_next_row_id, get_text_by_row_id ,add_updated_text_to_db
6
 
7
  dotenv.load_dotenv()
8
  PW=os.getenv("PW")
 
11
  updated_text2 = update_text_with_ai(text)
12
  return updated_text2
13
 
 
 
 
 
 
14
 
15
  def get_next_func(request: gr.Request):
16
  next_id = get_next_row_id(user_name=request.username)
 
28
 
29
  get_from_db.click(fn=get_next_func, outputs=[text_id, original_text])
30
  apply_ai.click(fn=apply_ai_func, inputs=original_text, outputs=updated_text)
31
+ add_to_db.click(fn=add_updated_text_to_db, inputs=[text_id, updated_text])
32
 
33
  demo.launch(auth=[("kerem", PW), ("mehmet", PW)],favicon_path="./tugra_logo.png")
gpt_utils.py CHANGED
@@ -12,6 +12,7 @@ Respond using Markdown.you know turkish
12
  sana verilen cumledeki hatalari gidericeksin
13
  1 yerine ı, 0 yerine İ, _ yerine ş,  yerine ğ, ^ yerine Ş yerleştirilecek
14
  & ve \n işaretlerini değiştirme
 
15
  """
16
 
17
 
 
12
  sana verilen cumledeki hatalari gidericeksin
13
  1 yerine ı, 0 yerine İ, _ yerine ş,  yerine ğ, ^ yerine Ş yerleştirilecek
14
  & ve \n işaretlerini değiştirme
15
+ g harfini değiştirme
16
  """
17
 
18