Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -11,11 +11,10 @@ import sys
|
|
| 11 |
|
| 12 |
load_dotenv()
|
| 13 |
hf_token = os.environ.get('HUGGINGFACEHUB_API_TOKEN')
|
| 14 |
-
|
| 15 |
-
#repo_id=os.environ.get('repo_id')
|
| 16 |
#port = os.getenv('port')
|
| 17 |
|
| 18 |
-
llm = HuggingFaceHub(repo_id=
|
| 19 |
huggingfacehub_api_token=hf_token,
|
| 20 |
model_kwargs={"min_length": 512, # for StarChat
|
| 21 |
"max_new_tokens": 1024, "do_sample": True, # for StarChat
|
|
@@ -44,6 +43,8 @@ async def chat(request: Request):
|
|
| 44 |
print(user_query)
|
| 45 |
docs = loader.load()
|
| 46 |
result = chain.run(docs)
|
|
|
|
|
|
|
| 47 |
print("AI Summarization: " + result)
|
| 48 |
return {'response': result}
|
| 49 |
except Exception as e:
|
|
|
|
| 11 |
|
| 12 |
load_dotenv()
|
| 13 |
hf_token = os.environ.get('HUGGINGFACEHUB_API_TOKEN')
|
| 14 |
+
repo_id=os.environ.get('repo_id')
|
|
|
|
| 15 |
#port = os.getenv('port')
|
| 16 |
|
| 17 |
+
llm = HuggingFaceHub(repo_id=repo_id, # for StarChat
|
| 18 |
huggingfacehub_api_token=hf_token,
|
| 19 |
model_kwargs={"min_length": 512, # for StarChat
|
| 20 |
"max_new_tokens": 1024, "do_sample": True, # for StarChat
|
|
|
|
| 43 |
print(user_query)
|
| 44 |
docs = loader.load()
|
| 45 |
result = chain.run(docs)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
print("AI Summarization: " + result)
|
| 49 |
return {'response': result}
|
| 50 |
except Exception as e:
|