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: 4.
|
9 |
app_file: run.py
|
10 |
pinned: false
|
11 |
hf_oauth: true
|
|
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
+
sdk_version: 4.31.2
|
9 |
app_file: run.py
|
10 |
pinned: false
|
11 |
hf_oauth: true
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
gradio-client @ git+https://github.com/gradio-app/gradio@
|
2 |
-
https://gradio-builds.s3.amazonaws.com/
|
|
|
1 |
+
gradio-client @ git+https://github.com/gradio-app/gradio@ee1e2942e0a1ae84a08a05464e41c8108a03fa9c#subdirectory=client/python
|
2 |
+
https://gradio-builds.s3.amazonaws.com/ee1e2942e0a1ae84a08a05464e41c8108a03fa9c/gradio-4.31.2-py3-none-any.whl
|
run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatinterface_system_prompt"]}, {"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 gradio as gr\n", "import time\n", "\n", "def echo(message, history, system_prompt, tokens):\n", " response = f\"System prompt: {system_prompt}\\n Message: {message}.\"\n", " for i in range(min(len(response), int(tokens))):\n", " time.sleep(0.05)\n", " yield response[: i+1]\n", "\n", "demo = gr.ChatInterface(
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatinterface_system_prompt"]}, {"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 gradio as gr\n", "import time\n", "\n", "\n", "def echo(message, history, system_prompt, tokens):\n", " response = f\"System prompt: {system_prompt}\\n Message: {message}.\"\n", " for i in range(min(len(response), int(tokens))):\n", " time.sleep(0.05)\n", " yield response[: i + 1]\n", "\n", "\n", "demo = gr.ChatInterface(\n", " echo,\n", " additional_inputs=[\n", " gr.Textbox(\"You are helpful AI.\", label=\"System Prompt\"),\n", " gr.Slider(10, 100),\n", " ],\n", ")\n", "\n", "if __name__ == \"__main__\":\n", " demo.queue().launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
@@ -1,18 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
import time
|
3 |
|
|
|
4 |
def echo(message, history, system_prompt, tokens):
|
5 |
response = f"System prompt: {system_prompt}\n Message: {message}."
|
6 |
for i in range(min(len(response), int(tokens))):
|
7 |
time.sleep(0.05)
|
8 |
-
yield response[: i+1]
|
|
|
9 |
|
10 |
-
demo = gr.ChatInterface(
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
16 |
|
17 |
if __name__ == "__main__":
|
18 |
-
demo.queue().launch()
|
|
|
1 |
import gradio as gr
|
2 |
import time
|
3 |
|
4 |
+
|
5 |
def echo(message, history, system_prompt, tokens):
|
6 |
response = f"System prompt: {system_prompt}\n Message: {message}."
|
7 |
for i in range(min(len(response), int(tokens))):
|
8 |
time.sleep(0.05)
|
9 |
+
yield response[: i + 1]
|
10 |
+
|
11 |
|
12 |
+
demo = gr.ChatInterface(
|
13 |
+
echo,
|
14 |
+
additional_inputs=[
|
15 |
+
gr.Textbox("You are helpful AI.", label="System Prompt"),
|
16 |
+
gr.Slider(10, 100),
|
17 |
+
],
|
18 |
+
)
|
19 |
|
20 |
if __name__ == "__main__":
|
21 |
+
demo.queue().launch()
|