alinasdkey commited on
Commit
112d29e
·
verified ·
1 Parent(s): 50cf515

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -1,8 +1,17 @@
1
  import os
2
- if not os.getenv("UNSLOTH_INSTALLED"):
3
- os.system('pip install git+https://github.com/unslothai/unsloth.git')
4
- os.environ["UNSLOTH_INSTALLED"] = "1"
5
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
 
8
  import gradio as gr
 
1
  import os
 
 
 
2
 
3
+ # Install PyTorch if it's missing
4
+ try:
5
+ import torch
6
+ except ImportError:
7
+ os.system("pip install torch")
8
+
9
+ # Install Unsloth if missing
10
+ try:
11
+ from unsloth import FastVisionModel
12
+ except ImportError:
13
+ os.system('pip install git+https://github.com/unslothai/unsloth.git')
14
+ from unsloth import FastVisionModel
15
 
16
 
17
  import gradio as gr