Hivra commited on
Commit
c621a1d
1 Parent(s): 75f71e5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ # Use a pipeline as a high-level helper
3
+ from transformers import pipeline
4
+
5
+ pipe = pipeline("text-generation", model="meta-llama/Llama-3.2-3B")
6
+
7
+ app = FastAPI()
8
+
9
+
10
+ @app.get('/')
11
+ def home():
12
+ return {"hello": "Detail"}
13
+
14
+
15
+ @app.get('/ask')
16
+ def ask(prompt: str):
17
+ result = pipe(prompt)
18
+ return result[0]