Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
import pandas as pd
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import pipeline
|
| 4 |
-
from
|
| 5 |
-
from
|
| 6 |
|
| 7 |
# Load your data
|
| 8 |
df = pd.read_csv("synthetic_profit.csv")
|
| 9 |
|
| 10 |
-
#
|
| 11 |
hf_pipeline = pipeline(
|
| 12 |
task="text2text-generation",
|
| 13 |
model="google/flan-t5-base",
|
| 14 |
-
device=-1 #
|
| 15 |
)
|
| 16 |
|
| 17 |
# LangChain agent setup
|
|
@@ -34,4 +34,4 @@ demo = gr.Interface(
|
|
| 34 |
description="Ask questions about synthetic SAP profitability data. Powered by Flan-T5-base via Hugging Face."
|
| 35 |
)
|
| 36 |
|
| 37 |
-
demo.launch()
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import pipeline
|
| 4 |
+
from langchain_community.llms import HuggingFacePipeline
|
| 5 |
+
from langchain_experimental.agents import create_pandas_dataframe_agent
|
| 6 |
|
| 7 |
# Load your data
|
| 8 |
df = pd.read_csv("synthetic_profit.csv")
|
| 9 |
|
| 10 |
+
# Setup lightweight Hugging Face pipeline with Flan-T5 base
|
| 11 |
hf_pipeline = pipeline(
|
| 12 |
task="text2text-generation",
|
| 13 |
model="google/flan-t5-base",
|
| 14 |
+
device=-1 # CPU only
|
| 15 |
)
|
| 16 |
|
| 17 |
# LangChain agent setup
|
|
|
|
| 34 |
description="Ask questions about synthetic SAP profitability data. Powered by Flan-T5-base via Hugging Face."
|
| 35 |
)
|
| 36 |
|
| 37 |
+
demo.launch()
|