Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,6 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import io
|
| 3 |
import openai
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
-
import IPython.display
|
| 7 |
-
from PIL import Image
|
| 8 |
-
|
| 9 |
-
import base64
|
| 10 |
-
from dotenv import load_dotenv, find_dotenv
|
| 11 |
-
_ = load_dotenv(find_dotenv()) # read local .env file
|
| 12 |
-
hf_api_key ='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'
|
| 13 |
-
|
| 14 |
-
import requests
|
| 15 |
-
|
| 16 |
-
def query(payload):
|
| 17 |
-
response = requests.post(API_URL, headers=headers, json=payload)
|
| 18 |
-
return response.content
|
| 19 |
-
|
| 20 |
-
# Helper function
|
| 21 |
-
import requests, json
|
| 22 |
-
|
| 23 |
openai.api_key = "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"
|
| 24 |
|
| 25 |
def predict(message, history):
|
|
@@ -50,11 +31,12 @@ A1 = gr.ChatInterface(predict,
|
|
| 50 |
clear_btn="Clear")
|
| 51 |
|
| 52 |
A2 = gr.load(
|
| 53 |
-
"huggingface/
|
| 54 |
-
title="Upon Further Review
|
|
|
|
| 55 |
theme= gr.themes.Glass(primary_hue="amber", neutral_hue="lime"))
|
| 56 |
|
| 57 |
A3 = gr.load("huggingface/google/vit-base-patch16-224")
|
| 58 |
|
| 59 |
-
pcp = gr.TabbedInterface([A1, A2], ["Chat",
|
| 60 |
pcp.queue().launch()
|
|
|
|
|
|
|
|
|
|
| 1 |
import openai
|
| 2 |
import gradio as gr
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
openai.api_key = "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"
|
| 5 |
|
| 6 |
def predict(message, history):
|
|
|
|
| 31 |
clear_btn="Clear")
|
| 32 |
|
| 33 |
A2 = gr.load(
|
| 34 |
+
"huggingface/Salesforce/blip-image-captioning-large",
|
| 35 |
+
title="Upon Further Review...",
|
| 36 |
+
description="Upload or Take a Photo Image, I'll Give You Description",
|
| 37 |
theme= gr.themes.Glass(primary_hue="amber", neutral_hue="lime"))
|
| 38 |
|
| 39 |
A3 = gr.load("huggingface/google/vit-base-patch16-224")
|
| 40 |
|
| 41 |
+
pcp = gr.TabbedInterface([A1, A2], ["Chat", "Vision"], theme= gr.themes.Glass(primary_hue="amber", neutral_hue="lime"))
|
| 42 |
pcp.queue().launch()
|