Spaces:
Runtime error
Runtime error
Commit
·
3459d0e
1
Parent(s):
4025d5d
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI, Request
|
| 2 |
import streamlit as st
|
| 3 |
from fastapi.responses import JSONResponse
|
|
@@ -24,7 +31,8 @@ repo_id = os.environ.get('repo_id')
|
|
| 24 |
#port = os.getenv('port')
|
| 25 |
|
| 26 |
llm = HuggingFaceHub(repo_id=repo_id,
|
| 27 |
-
huggingfacehub_api_token="
|
|
|
|
| 28 |
model_kwargs={"min_length":1024,
|
| 29 |
"max_new_tokens":5632, "do_sample":True,
|
| 30 |
"temperature":0.1,
|
|
|
|
| 1 |
+
#这个可以工作!!!
|
| 2 |
+
#url = 'https://binqiangliu-fastapi-in-docker.hf.space/api/chat'
|
| 3 |
+
#data = {'user_question': "Tell me a joke"}
|
| 4 |
+
#response = requests.post(url, json=data)
|
| 5 |
+
#result = response.json()
|
| 6 |
+
|
| 7 |
+
|
| 8 |
from fastapi import FastAPI, Request
|
| 9 |
import streamlit as st
|
| 10 |
from fastapi.responses import JSONResponse
|
|
|
|
| 31 |
#port = os.getenv('port')
|
| 32 |
|
| 33 |
llm = HuggingFaceHub(repo_id=repo_id,
|
| 34 |
+
#huggingfacehub_api_token="hf_p***K",
|
| 35 |
+
huggingfacehub_api_token=HUGGINGFACEHUB_API_TOKEN,
|
| 36 |
model_kwargs={"min_length":1024,
|
| 37 |
"max_new_tokens":5632, "do_sample":True,
|
| 38 |
"temperature":0.1,
|