anaspro
commited on
Commit
·
858845e
1
Parent(s):
2882371
updatE
Browse files- app.py +2 -0
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -6,6 +6,7 @@ from threading import Thread
|
|
| 6 |
|
| 7 |
import av
|
| 8 |
import gradio as gr
|
|
|
|
| 9 |
import torch
|
| 10 |
from transformers import AutoModelForImageTextToText, AutoProcessor
|
| 11 |
from transformers.generation.streamers import TextIteratorStreamer
|
|
@@ -153,6 +154,7 @@ def process_history(history: list[dict]) -> list[dict]:
|
|
| 153 |
return messages
|
| 154 |
|
| 155 |
|
|
|
|
| 156 |
@torch.inference_mode()
|
| 157 |
def generate(message: dict, history: list[dict], system_prompt: str = "", max_new_tokens: int = 512) -> Iterator[str]:
|
| 158 |
if not validate_media_constraints(message):
|
|
|
|
| 6 |
|
| 7 |
import av
|
| 8 |
import gradio as gr
|
| 9 |
+
import spaces
|
| 10 |
import torch
|
| 11 |
from transformers import AutoModelForImageTextToText, AutoProcessor
|
| 12 |
from transformers.generation.streamers import TextIteratorStreamer
|
|
|
|
| 154 |
return messages
|
| 155 |
|
| 156 |
|
| 157 |
+
@spaces.GPU()
|
| 158 |
@torch.inference_mode()
|
| 159 |
def generate(message: dict, history: list[dict], system_prompt: str = "", max_new_tokens: int = 512) -> Iterator[str]:
|
| 160 |
if not validate_media_constraints(message):
|
requirements.txt
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
gradio>=4.0.0
|
|
|
|
| 2 |
transformers>=4.35.0
|
| 3 |
torch>=2.1.0
|
| 4 |
av
|
|
|
|
| 1 |
gradio>=4.0.0
|
| 2 |
+
spaces[huggingface]>=0.28.0
|
| 3 |
transformers>=4.35.0
|
| 4 |
torch>=2.1.0
|
| 5 |
av
|