Spaces:
Runtime error
Runtime error
DQ commited on
Commit ·
ff5131a
1
Parent(s): 1834cf8
add requirements.txt
Browse files- app.py +4 -3
- requirements.txt +5 -0
app.py
CHANGED
|
@@ -8,7 +8,6 @@ from transformers import BlipProcessor, BlipForConditionalGeneration
|
|
| 8 |
from PIL import Image
|
| 9 |
|
| 10 |
|
| 11 |
-
|
| 12 |
load_dotenv()
|
| 13 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 14 |
|
|
@@ -21,11 +20,13 @@ model_id = "gpt-3.5-turbo"
|
|
| 21 |
def display_giv(url):
|
| 22 |
# for GIV
|
| 23 |
# url = f"https://api.momenti.tv/v4/media/moment_infos/{moment_info_id}/thumbnail"
|
| 24 |
-
|
| 25 |
response = requests.get(url)
|
| 26 |
|
| 27 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
| 28 |
-
model = BlipForConditionalGeneration.from_pretrained(
|
|
|
|
|
|
|
| 29 |
|
| 30 |
raw_image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
| 31 |
|
|
|
|
| 8 |
from PIL import Image
|
| 9 |
|
| 10 |
|
|
|
|
| 11 |
load_dotenv()
|
| 12 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 13 |
|
|
|
|
| 20 |
def display_giv(url):
|
| 21 |
# for GIV
|
| 22 |
# url = f"https://api.momenti.tv/v4/media/moment_infos/{moment_info_id}/thumbnail"
|
| 23 |
+
|
| 24 |
response = requests.get(url)
|
| 25 |
|
| 26 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
| 27 |
+
model = BlipForConditionalGeneration.from_pretrained(
|
| 28 |
+
"Salesforce/blip-image-captioning-large"
|
| 29 |
+
)
|
| 30 |
|
| 31 |
raw_image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
| 32 |
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
requests
|
| 2 |
+
gradio
|
| 3 |
+
openai
|
| 4 |
+
python-dotenv
|
| 5 |
+
transformers
|