Update app.py
Browse files
app.py
CHANGED
|
@@ -95,24 +95,35 @@
|
|
| 95 |
|
| 96 |
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
import gradio as gr
|
| 99 |
|
| 100 |
-
def
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
yes_man,
|
| 108 |
-
chatbot=gr.Chatbot(placeholder="<strong>Ask me a yes or no question</strong><br>Ask me anything"),
|
| 109 |
-
textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=15),
|
| 110 |
-
title="Yes Man",
|
| 111 |
-
description="Ask Yes Man any question",
|
| 112 |
-
theme="soft",
|
| 113 |
-
examples=[{"text": "Hello"}, {"text": "Am I cool?"}, {"text": "Are tomatoes vegetables?"}],
|
| 114 |
-
cache_examples=True,
|
| 115 |
-
retry_btn=None,
|
| 116 |
-
undo_btn="Delete Previous",
|
| 117 |
-
clear_btn="Clear",
|
| 118 |
-
).launch()
|
|
|
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
+
# import gradio as gr
|
| 99 |
+
|
| 100 |
+
# def yes_man(message, history):
|
| 101 |
+
# if message.endswith("?"):
|
| 102 |
+
# return "Yes"
|
| 103 |
+
# else:
|
| 104 |
+
# return "Ask me anything!"
|
| 105 |
+
|
| 106 |
+
# gr.ChatInterface(
|
| 107 |
+
# yes_man,
|
| 108 |
+
# chatbot=gr.Chatbot(placeholder="<strong>Ask me a yes or no question</strong><br>Ask me anything"),
|
| 109 |
+
# textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=15),
|
| 110 |
+
# title="Yes Man",
|
| 111 |
+
# description="Ask Yes Man any question",
|
| 112 |
+
# theme="soft",
|
| 113 |
+
# examples=[{"text": "Hello"}, {"text": "Am I cool?"}, {"text": "Are tomatoes vegetables?"}],
|
| 114 |
+
# cache_examples=True,
|
| 115 |
+
# retry_btn=None,
|
| 116 |
+
# undo_btn="Delete Previous",
|
| 117 |
+
# clear_btn="Clear",
|
| 118 |
+
# ).launch()
|
| 119 |
+
|
| 120 |
+
|
| 121 |
import gradio as gr
|
| 122 |
|
| 123 |
+
def count_files(message, history):
|
| 124 |
+
num_files = len(message["files"])
|
| 125 |
+
return f"You uploaded {num_files} files"
|
| 126 |
+
|
| 127 |
+
demo = gr.ChatInterface(fn=count_files, examples=[{"text": "Hello", "files": []}], title="Echo Bot", multimodal=True)
|
| 128 |
+
|
| 129 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|