CognitiveScience commited on
Commit
fb1891a
·
1 Parent(s): 3fa32a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -99,9 +99,9 @@ def delete_all_reviews():
99
  reviews, total_reviews = get_latest_reviews(db)
100
  db.close()
101
  return reviews, total_reviews
102
- def cs(link):
103
- response="Hi " + "bcf" #(link) #acf("hello world")[0]["label"] + str(math.trunc(acf("hello world")[0]["score"])*100/100)+bcf(link)
104
- return response #result #soup.prettify()
105
 
106
  def respond3(message, chat_history):
107
  bot_message = random.choice(["How are you3?", "I love you3", "I'm very hungry3"])
@@ -113,17 +113,26 @@ def respond3(message, chat_history):
113
  with gr.Blocks() as demo:
114
  with gr.Row():
115
  with gr.Column():
 
 
 
 
116
  name = gr.Textbox(label="Name", placeholder="ur name?")
117
  review = gr.Radio(label="How satisfied are you with your pick?", choices=[1, 2, 3, 4, 5, 6])
118
  comments = gr.Textbox(label="Comments0", lines=10, placeholder="comm?")
119
- submit = gr.Button(value="Submit Choice")
120
  #cschatbot = gr.Chatbot()
121
  #csinp = gr.Textbox()
122
  #csout=cs(csinp)
123
  #csclear = gr.ClearButton([csinp, cschatbot])
124
 
125
  #csinp.submit(cs, [csinp, cschatbot], [csinp, cschatbot])
126
- submit.click(add_review, [name, review, comments], [data, count])
 
 
 
 
 
127
 
128
 
129
  with gr.Row():
@@ -173,6 +182,8 @@ with gr.Blocks() as demo:
173
  count = gr.Number(label="Total number of reviews")
174
 
175
  submit.click(add_review, [name, review, comments], [data, count])
 
 
176
 
177
  record2del = gr.Textbox(label="Id: ", lines=1, placeholder="to delete?")
178
 
 
99
  reviews, total_reviews = get_latest_reviews(db)
100
  db.close()
101
  return reviews, total_reviews
102
+ #def cs(link):
103
+ # response="Hi " + "bcf" #(link) #acf("hello world")[0]["label"] + str(math.trunc(acf("hello world")[0]["score"])*100/100)+bcf(link)
104
+ # return response #result #soup.prettify()
105
 
106
  def respond3(message, chat_history):
107
  bot_message = random.choice(["How are you3?", "I love you3", "I'm very hungry3"])
 
113
  with gr.Blocks() as demo:
114
  with gr.Row():
115
  with gr.Column():
116
+ with gr.Box():
117
+ gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
118
+ #data = gr.Dataframe()
119
+ count = gr.Number(label="Total number of reviews")
120
  name = gr.Textbox(label="Name", placeholder="ur name?")
121
  review = gr.Radio(label="How satisfied are you with your pick?", choices=[1, 2, 3, 4, 5, 6])
122
  comments = gr.Textbox(label="Comments0", lines=10, placeholder="comm?")
123
+ cssubmit = gr.Button(value="Submit Choice")
124
  #cschatbot = gr.Chatbot()
125
  #csinp = gr.Textbox()
126
  #csout=cs(csinp)
127
  #csclear = gr.ClearButton([csinp, cschatbot])
128
 
129
  #csinp.submit(cs, [csinp, cschatbot], [csinp, cschatbot])
130
+
131
+ def cs(link):
132
+ response="Hi " + "bcf" #(link) #acf("hello world")[0]["label"] + str(math.trunc(acf("hello world")[0]["score"])*100/100)+bcf(link)
133
+ return response #result #soup.prettify()
134
+ submit.click(cs, name, name)
135
+
136
 
137
 
138
  with gr.Row():
 
182
  count = gr.Number(label="Total number of reviews")
183
 
184
  submit.click(add_review, [name, review, comments], [data, count])
185
+
186
+ #cssubmit.click(add_review, [name, review, comments], [data, count])
187
 
188
  record2del = gr.Textbox(label="Id: ", lines=1, placeholder="to delete?")
189