nisten commited on
Commit
246c14d
·
verified ·
1 Parent(s): a8dc096

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -1,7 +1,14 @@
 
1
  import os
2
- !os.system('pip install transformers bitsandbytes sentencepiece torch')
3
- # import gradio as gr
4
- #!pip install transformers bitsandbytes sentencepiece torch
 
 
 
 
 
 
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