Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
|
|
| 1 |
import os
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
from http import HTTPStatus
|
| 6 |
|
| 7 |
# from dashscope import Generation
|
|
@@ -95,10 +102,6 @@ from urllib.error import HTTPError
|
|
| 95 |
|
| 96 |
# demo.queue(api_open=False)
|
| 97 |
# demo.launch(max_threads=30, share=True)
|
| 98 |
-
import os
|
| 99 |
-
import torch
|
| 100 |
-
import gradio as gr
|
| 101 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 102 |
from typing import List, Optional, Tuple, Dict
|
| 103 |
|
| 104 |
# Set up default system prompt and history/message structures
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
import os
|
| 3 |
+
# Install packages using subprocess
|
| 4 |
+
subprocess.run(["pip", "install", "transformers", "bitsandbytes", "sentencepiece", "torch"], check=True)
|
| 5 |
+
|
| 6 |
+
# Continue with the rest of your script
|
| 7 |
+
import torch
|
| 8 |
+
import gradio as gr
|
| 9 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 10 |
+
|
| 11 |
+
# Rest of your application logic
|
| 12 |
from http import HTTPStatus
|
| 13 |
|
| 14 |
# from dashscope import Generation
|
|
|
|
| 102 |
|
| 103 |
# demo.queue(api_open=False)
|
| 104 |
# demo.launch(max_threads=30, share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
from typing import List, Optional, Tuple, Dict
|
| 106 |
|
| 107 |
# Set up default system prompt and history/message structures
|