Spaces:
Runtime error
Runtime error
Commit
·
5d0fa3e
1
Parent(s):
378394c
Update app.py
Browse files
app.py
CHANGED
|
@@ -115,35 +115,11 @@ 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 |
-
|
| 120 |
-
|
| 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():
|
| 139 |
-
name = gr.Textbox(label="Name", placeholder="What is your name?")
|
| 140 |
-
review = gr.Radio(label="How satisfied are you with using gradio?", choices=[1, 2, 3, 4, 5])
|
| 141 |
-
comments = gr.Textbox(label="Comments", lines=10, placeholder="Do you have any feedback on gradio?")
|
| 142 |
-
submit = gr.Button(value="Submit Feedback")
|
| 143 |
-
with gr.Column():
|
| 144 |
-
gr.FileExplorer(label="Working directory")
|
| 145 |
-
gr.FileExplorer(root="./data", label="Persistent storage")
|
| 146 |
-
|
| 147 |
with gr.Column():
|
| 148 |
chatbot = gr.Chatbot()
|
| 149 |
msg = gr.Textbox()
|
|
@@ -157,47 +133,21 @@ with gr.Blocks() as demo:
|
|
| 157 |
return "", chat_history
|
| 158 |
|
| 159 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 160 |
-
|
| 161 |
-
with gr.Column():
|
| 162 |
-
submitsave = gr.Button(value="Save")
|
| 163 |
-
|
| 164 |
-
def backup_db2():
|
| 165 |
-
shutil.copyfile(DB_FILE, "./data/reviews.db")
|
| 166 |
-
db = sqlite3.connect(DB_FILE)
|
| 167 |
-
reviews = db.execute("SELECT * FROM reviews").fetchall()
|
| 168 |
-
pd.DataFrame(reviews).to_csv("./data/reviews.csv", index=False)
|
| 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 |
|
| 191 |
-
record2del = gr.Textbox(label="Id: ", lines=1, placeholder="to delete?")
|
| 192 |
|
| 193 |
-
submit2 = gr.Button(value="Delete Review")
|
| 194 |
-
id_input = gr.Number(value=202, visible=False)
|
| 195 |
-
submit2.click(delete_review, id_input)
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
-
submit3 = gr.Button(value="Delete All Reviews")
|
| 200 |
-
submit3.click(delete_all_reviews)
|
| 201 |
|
| 202 |
|
| 203 |
demo.load(load_data, None, [data, count])
|
|
|
|
| 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="Rates!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
with gr.Column():
|
| 124 |
chatbot = gr.Chatbot()
|
| 125 |
msg = gr.Textbox()
|
|
|
|
| 133 |
return "", chat_history
|
| 134 |
|
| 135 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
submit.click(add_review, [name, review, comments], [data, count])
|
| 138 |
|
| 139 |
#cssubmit.click(add_review, [name, review, comments], [data, count])
|
| 140 |
|
| 141 |
+
#record2del = gr.Textbox(label="Id: ", lines=1, placeholder="to delete?")
|
| 142 |
|
| 143 |
+
#submit2 = gr.Button(value="Delete Review")
|
| 144 |
+
#id_input = gr.Number(value=202, visible=False)
|
| 145 |
+
#submit2.click(delete_review, id_input)
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
+
#submit3 = gr.Button(value="Delete All Reviews")
|
| 150 |
+
#submit3.click(delete_all_reviews)
|
| 151 |
|
| 152 |
|
| 153 |
demo.load(load_data, None, [data, count])
|