ramhemanth580 commited on
Commit
78c4019
·
verified ·
1 Parent(s): d5f1b7c

Update app.py

Browse files

Changed the model to "TheBloke/Qwen-7B-Chat-GPTQ"

Files changed (1) hide show
  1. app.py +24 -24
app.py CHANGED
@@ -1,25 +1,25 @@
1
-
2
- from fastapi import FastAPI
3
- from transformers import pipeline
4
-
5
-
6
- ## create a new FASTAPI app instance
7
-
8
- app = FastAPI()
9
-
10
- ## Initiate the text generation pipeline
11
- pipe = pipeline("text-generation", model="TheBloke/Qwen-7B-Chat-AWQ", trust_remote_code=True)
12
-
13
-
14
- @app.get("/")
15
- def home():
16
- return {"message": "Hello World"}
17
-
18
- # Define a function to handle the GET request at '/generate'
19
-
20
- @app.get("/generate")
21
- def generate(text:str):
22
- ## use the pipeline to generate text from given input test
23
- output = pipe(text, max_length=100, clean_up_tokenization_spaces=True)
24
- ##return the generate text in JSON response
25
  return{"output":output[0]['generated_text']}
 
1
+
2
+ from fastapi import FastAPI
3
+ from transformers import pipeline
4
+
5
+
6
+ ## create a new FASTAPI app instance
7
+
8
+ app = FastAPI()
9
+
10
+ ## Initiate the text generation pipeline
11
+ pipe = pipeline("text-generation", model="TheBloke/Qwen-7B-Chat-GPTQ", trust_remote_code=True)
12
+
13
+
14
+ @app.get("/")
15
+ def home():
16
+ return {"message": "Hello World"}
17
+
18
+ # Define a function to handle the GET request at '/generate'
19
+
20
+ @app.get("/generate")
21
+ def generate(text:str):
22
+ ## use the pipeline to generate text from given input test
23
+ output = pipe(text, max_length=100, clean_up_tokenization_spaces=True)
24
+ ##return the generate text in JSON response
25
  return{"output":output[0]['generated_text']}