CognitiveScience commited on
Commit
771b523
·
1 Parent(s): efebb1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -43
app.py CHANGED
@@ -114,35 +114,25 @@ def respond3(message, chat_history):
114
  with gr.Blocks() as demo:
115
  with gr.Row():
116
  with gr.Column():
117
- gr.Markdown("This is a demo of using gr.Interface inside blocks.")
118
- with gr.Row():
119
- data = gr.Dataframe()
120
- count = gr.Number(label="Total number of reviews")
121
-
122
- submit = gr.Button(value="Add Review")
123
- name = gr.Textbox(label="Name", placeholder="ur name?")
124
-
125
- #data = gr.Dataframe()
126
- count = gr.Number(label="Total number of reviews")
127
- #name = gr.Textbox(label="Name", placeholder="ur name?")
128
- review = gr.Radio(label="How satisfied are you with your pick?", choices=[1, 2, 3, 4, 5, 6])
129
- comments = gr.Textbox(label="Comments0", lines=10, placeholder="comm?")
130
- cssubmit = gr.Button(value="Submit Choice")
131
- #cschatbot = gr.Chatbot()
132
- #csinp = gr.Textbox()
133
- #csout=cs(csinp)
134
- #csclear = gr.ClearButton([csinp, cschatbot])
135
-
136
- #csinp.submit(cs, [csinp, cschatbot], [csinp, cschatbot])
137
-
138
- def cs(link):
139
- response="Hi " + link #(link) #acf("hello world")[0]["label"] + str(math.trunc(acf("hello world")[0]["score"])*100/100)+bcf(link)
140
- return response,1 #result #soup.prettify()
141
- cssubmit.click(cs, name, [comments,count])
142
- interface = gr.Interface(cs, gr.Textbox(), gr.Textbox())
143
- interface.launch(inline=True)
144
- #gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
145
-
146
 
147
  with gr.Row():
148
  with gr.Column():
@@ -179,22 +169,22 @@ with gr.Blocks() as demo:
179
  print("updating db")
180
  repo.push_to_hub(blocking=False, commit_message=f"Updating data at {datetime.datetime.now()}")
181
  submit.click(backup_db2)
182
- #with gr.Column():
183
- #with gr.Box():
184
- # gr.Code(
185
- # value="""def hello_world():
186
- #return "Hello, world!"
187
 
188
- #print(hello_world())""",
189
- # language="python",
190
- # interactive=True,
191
- # show_label=False,
192
- # )
193
- #gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
194
- #data = gr.Dataframe()
195
- #count = gr.Number(label="Total number of reviews")
196
 
197
- #submit.click(add_review, [name, review, comments], [data, count])
198
 
199
  #cssubmit.click(add_review, [name, review, comments], [data, count])
200
 
 
114
  with gr.Blocks() as demo:
115
  with gr.Row():
116
  with gr.Column():
117
+ with gr.Box():
118
+ gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
119
+ #data = gr.Dataframe()
120
+ count = gr.Number(label="Total number of reviews")
121
+ name = gr.Textbox(label="Name", placeholder="ur name?")
122
+ review = gr.Radio(label="How satisfied are you with your pick?", choices=[1, 2, 3, 4, 5, 6])
123
+ comments = gr.Textbox(label="Comments0", lines=10, placeholder="comm?")
124
+ cssubmit = gr.Button(value="Submit Choice")
125
+ #cschatbot = gr.Chatbot()
126
+ #csinp = gr.Textbox()
127
+ #csout=cs(csinp)
128
+ #csclear = gr.ClearButton([csinp, cschatbot])
129
+
130
+ #csinp.submit(cs, [csinp, cschatbot], [csinp, cschatbot])
131
+
132
+ def cs(link):
133
+ response="Hi " + link #(link) #acf("hello world")[0]["label"] + str(math.trunc(acf("hello world")[0]["score"])*100/100)+bcf(link)
134
+ return response,1 #result #soup.prettify()
135
+ cssubmit.click(cs, name, [comments,count])
 
 
 
 
 
 
 
 
 
 
136
 
137
  with gr.Row():
138
  with gr.Column():
 
169
  print("updating db")
170
  repo.push_to_hub(blocking=False, commit_message=f"Updating data at {datetime.datetime.now()}")
171
  submit.click(backup_db2)
172
+ with gr.Column():
173
+ with gr.Box():
174
+ gr.Code(
175
+ value="""def hello_world():
176
+ return "Hello, world!"
177
 
178
+ print(hello_world())""",
179
+ language="python",
180
+ interactive=True,
181
+ show_label=False,
182
+ )
183
+ gr.Markdown("Based on dataset [here](https://huggingface.co/datasets/freddyaboulton/gradio-reviews)")
184
+ data = gr.Dataframe()
185
+ count = gr.Number(label="Total number of reviews")
186
 
187
+ submit.click(add_review, [name, review, comments], [data, count])
188
 
189
  #cssubmit.click(add_review, [name, review, comments], [data, count])
190