Spaces:
Paused
Paused
ManishThota
commited on
Commit
•
7db5813
1
Parent(s):
bf8c942
Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,6 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
6 |
#Setting device to cuda
|
7 |
torch.set_default_device("cuda")
|
8 |
|
9 |
-
torch.hub.download_url_to_file('https://github.com/manishkumart/SparrowVQE/blob/main/data/Images/week_01/week_01_page_024.png', 'week_01_page_024.png')
|
10 |
-
|
11 |
-
# https://github.com/manishkumart/SparrowVQE/blob/main/data/Images/week_01/week_01_page_024.png
|
12 |
-
|
13 |
-
|
14 |
# # Ensure GPU usage if available
|
15 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
# torch.set_default_tensor_type('torch.cuda.FloatTensor' if device=='cuda' else 'torch.FloatTensor')
|
@@ -46,8 +41,16 @@ def predict_answer(image, question, max_tokens):
|
|
46 |
def gradio_predict(image, question, max_tokens):
|
47 |
answer = predict_answer(image, question, max_tokens)
|
48 |
return answer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
examples = [["week_01_page_024.png", "Can you explain the slide?"]]
|
51 |
# Define the Gradio interface
|
52 |
iface = gr.Interface(
|
53 |
fn=gradio_predict,
|
|
|
6 |
#Setting device to cuda
|
7 |
torch.set_default_device("cuda")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
9 |
# # Ensure GPU usage if available
|
10 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
# torch.set_default_tensor_type('torch.cuda.FloatTensor' if device=='cuda' else 'torch.FloatTensor')
|
|
|
41 |
def gradio_predict(image, question, max_tokens):
|
42 |
answer = predict_answer(image, question, max_tokens)
|
43 |
return answer
|
44 |
+
|
45 |
+
examples = [["data/week_01_page_024.png", 'Can you explain the slide?'],
|
46 |
+
["data/week_03_page_091.png", 'Can you explain the slide?'],
|
47 |
+
["data/week_01_page_062.png", 'Are the training images labeled?'],
|
48 |
+
["data/week_05_page_027.png", 'What is meant by eigenvalue multiplicity?']],
|
49 |
+
["data/week_05_page_030.png", 'What does K represent?'],
|
50 |
+
["data/week_15_page_046.png", 'How are individual heterogeneous models trained?'],
|
51 |
+
["data/week_15_page_021.png", 'How does Bagging affect error?']],
|
52 |
+
["data/week_15_page_037.png", 'What does the '+' and '-' represent?']]
|
53 |
|
|
|
54 |
# Define the Gradio interface
|
55 |
iface = gr.Interface(
|
56 |
fn=gradio_predict,
|