Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- README +14 -0
- __pycache__/gradioui.cpython-311.pyc +0 -0
- app.py +13 -0
- gradioui.py +32 -0
- requirements.txt +6 -0
README
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
title: Gradio Client for Agent
|
2 |
+
emoji: ⚡
|
3 |
+
colorFrom: pink
|
4 |
+
colorTo: yellow
|
5 |
+
sdk: gradio
|
6 |
+
sdk_version: 5.15.0
|
7 |
+
app_file: app.py
|
8 |
+
pinned: false
|
9 |
+
tags:
|
10 |
+
- smolagents
|
11 |
+
- agent
|
12 |
+
- smolagent
|
13 |
+
- tool
|
14 |
+
- agent-course
|
__pycache__/gradioui.cpython-311.pyc
ADDED
Binary file (1.62 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/book/Agents/02_App.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = []
|
5 |
+
|
6 |
+
# %% ../../nbs/book/Agents/02_App.ipynb 5
|
7 |
+
from fastcore.all import *
|
8 |
+
import time
|
9 |
+
from gradioui import GradioUI
|
10 |
+
|
11 |
+
# %% ../../nbs/book/Agents/02_App.ipynb 6
|
12 |
+
#| eval: false
|
13 |
+
GradioUI().launch()
|
gradioui.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/book/Agents/01_GradioUI.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['slow_echo', 'GradioUI']
|
5 |
+
|
6 |
+
# %% ../../nbs/book/Agents/01_GradioUI.ipynb 3
|
7 |
+
from fastcore.all import *
|
8 |
+
import time
|
9 |
+
import gradio as gr
|
10 |
+
|
11 |
+
# %% ../../nbs/book/Agents/01_GradioUI.ipynb 4
|
12 |
+
#| eval: false#|exports
|
13 |
+
#| eval: false
|
14 |
+
|
15 |
+
# %% ../../nbs/book/Agents/01_GradioUI.ipynb 5
|
16 |
+
def slow_echo(message, history):
|
17 |
+
for i in range(len(message)):
|
18 |
+
time.sleep(0.05)
|
19 |
+
yield "You typed: " + message[: i + 1]
|
20 |
+
|
21 |
+
# %% ../../nbs/book/Agents/01_GradioUI.ipynb 10
|
22 |
+
class GradioUI(object):
|
23 |
+
def __init__(self, share=True):
|
24 |
+
store_attr()
|
25 |
+
|
26 |
+
def launch (self):
|
27 |
+
demo = gr.ChatInterface(fn=slow_echo,
|
28 |
+
type='messages',
|
29 |
+
flagging_mode="manual",
|
30 |
+
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
31 |
+
save_history=True)
|
32 |
+
return demo.launch(share=self.share)
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
markdownify
|
2 |
+
smolagents
|
3 |
+
requests
|
4 |
+
duckduckgo_search
|
5 |
+
pandas
|
6 |
+
mistletoe
|