Not-Grim-Refer commited on
Commit
829584d
·
1 Parent(s): 5f64a34

huggingface transformers agents

Browse files
Files changed (3) hide show
  1. app.py +18 -0
  2. readme.md +14 -0
  3. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import transformers
3
+
4
+ # Define the agents
5
+ text_generator_agent = transformers.AutoGPT(model_name="gpt-3-medium")
6
+ text_translator_agent = transformers.AutoBard(model_name="bard")
7
+
8
+ # Create the UI
9
+ gr.Interface(
10
+ title="Huggingface Transformers Agents",
11
+ inputs=[gr.Textbox(label="Enter your input:")],
12
+ outputs=[gr.Textbox(label="Output:")],
13
+ on_submit=lambda inputs: {
14
+ "Output": text_generator_agent.generate(inputs["Input"])
15
+ if inputs["Input"].startswith("generate")
16
+ else text_translator_agent.translate(inputs["Input"])
17
+ },
18
+ ).launch()
readme.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: huggingface-transformers-agents
3
+ emoji: 🌍
4
+ colorFrom: red
5
+ colorTo: red
6
+ sdk: gradio
7
+ sdk_version: 3.30.3
8
+ app_file: app.py
9
+ pinned: true
10
+ license: mit
11
+
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-refer
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ transformers