Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -5,7 +5,7 @@ emoji: 🔥
|
|
| 5 |
colorFrom: indigo
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
-
sdk_version:
|
| 9 |
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
hf_oauth: true
|
|
|
|
| 5 |
colorFrom: indigo
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
+
sdk_version: 6.0.0
|
| 9 |
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
hf_oauth: true
|
run.ipynb
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatinterface_deep_link"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import time\n", "import gradio as gr\n", "\n", "def slow_echo(message, history):\n", " for i in range(len(message[\"text\"])):\n", " time.sleep(0.05)\n", " yield \"You typed: \" + message[\"text\"][: i + 1]\n", "\n", "chat = gr.ChatInterface(\n", " slow_echo,\n", "
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatinterface_deep_link"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import time\n", "import gradio as gr\n", "\n", "def slow_echo(message, history):\n", " for i in range(len(message[\"text\"])):\n", " time.sleep(0.05)\n", " yield \"You typed: \" + message[\"text\"][: i + 1]\n", "\n", "chat = gr.ChatInterface(\n", " slow_echo,\n", " flagging_mode=\"manual\",\n", " flagging_options=[\"Like\", \"Spam\", \"Inappropriate\", \"Other\"],\n", " save_history=False,\n", " multimodal=True,\n", " api_name=\"chat\"\n", ")\n", "\n", "with gr.Blocks() as demo:\n", "\n", " chat.render()\n", " gr.DeepLinkButton()\n", "\n", "with demo.route(\"cached_examples\"):\n", " gr.Interface(lambda x, y: f\"{y}: {x}\",\n", " inputs=[gr.Textbox(label=\"name\"),\n", " gr.Radio(label=\"Salutation\", choices=[\"Hello\", \"Greetings\"])\n", " ],\n", " outputs=gr.Textbox(label=\"Output\"),\n", " examples=[[\"Freddy\", \"Hello\"]],\n", " cache_examples=True,\n", " api_name=\"predict\",\n", " deep_link=True)\n", "\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
|
@@ -8,11 +8,11 @@ def slow_echo(message, history):
|
|
| 8 |
|
| 9 |
chat = gr.ChatInterface(
|
| 10 |
slow_echo,
|
| 11 |
-
type="messages",
|
| 12 |
flagging_mode="manual",
|
| 13 |
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
| 14 |
save_history=False,
|
| 15 |
multimodal=True,
|
|
|
|
| 16 |
)
|
| 17 |
|
| 18 |
with gr.Blocks() as demo:
|
|
@@ -28,9 +28,9 @@ with demo.route("cached_examples"):
|
|
| 28 |
outputs=gr.Textbox(label="Output"),
|
| 29 |
examples=[["Freddy", "Hello"]],
|
| 30 |
cache_examples=True,
|
|
|
|
| 31 |
deep_link=True)
|
| 32 |
|
| 33 |
|
| 34 |
-
|
| 35 |
if __name__ == "__main__":
|
| 36 |
demo.launch()
|
|
|
|
| 8 |
|
| 9 |
chat = gr.ChatInterface(
|
| 10 |
slow_echo,
|
|
|
|
| 11 |
flagging_mode="manual",
|
| 12 |
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
| 13 |
save_history=False,
|
| 14 |
multimodal=True,
|
| 15 |
+
api_name="chat"
|
| 16 |
)
|
| 17 |
|
| 18 |
with gr.Blocks() as demo:
|
|
|
|
| 28 |
outputs=gr.Textbox(label="Output"),
|
| 29 |
examples=[["Freddy", "Hello"]],
|
| 30 |
cache_examples=True,
|
| 31 |
+
api_name="predict",
|
| 32 |
deep_link=True)
|
| 33 |
|
| 34 |
|
|
|
|
| 35 |
if __name__ == "__main__":
|
| 36 |
demo.launch()
|