Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,15 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# (Keep Constants as is)
|
| 9 |
# --- Constants ---
|
|
@@ -88,10 +96,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 88 |
|
| 89 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 90 |
try:
|
| 91 |
-
llm =
|
| 92 |
-
repo_id="google/flan-t5-xl",
|
| 93 |
-
model_kwargs={"temperature": 0.5, "max_length": 512}
|
| 94 |
-
)
|
| 95 |
agent = BasicAgent(llm)
|
| 96 |
except Exception as e:
|
| 97 |
print(f"Error instantiating agent: {e}")
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from transformers import pipeline
|
| 7 |
+
|
| 8 |
+
# This model doesn't require a token and works for simple tasks
|
| 9 |
+
llm_pipeline = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 10 |
+
|
| 11 |
+
class TransformersLLM:
|
| 12 |
+
def __call__(self, prompt):
|
| 13 |
+
output = llm_pipeline(prompt, max_new_tokens=100)
|
| 14 |
+
return output[0]['generated_text']
|
| 15 |
|
| 16 |
# (Keep Constants as is)
|
| 17 |
# --- Constants ---
|
|
|
|
| 96 |
|
| 97 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 98 |
try:
|
| 99 |
+
llm = TransformersLLM()
|
|
|
|
|
|
|
|
|
|
| 100 |
agent = BasicAgent(llm)
|
| 101 |
except Exception as e:
|
| 102 |
print(f"Error instantiating agent: {e}")
|