|
import gradio as gr |
|
import requests |
|
import base64 |
|
import json |
|
import os |
|
|
|
print("this works") |
|
|
|
def function(paramater): |
|
test = os.environ.get("test") |
|
url = f"https://graph.facebook.com/v15.0/{paramater}" |
|
payload = { |
|
'Authorization': 'Bearer ' + test |
|
} |
|
response = requests.get(url, headers=payload) |
|
response = json.loads(response.text) |
|
image = requests.get(response["url"], headers=payload) |
|
image = image.content |
|
|
|
|
|
response = requests.post("https://tommy24-this-is-indeed-cool.hf.space/run/predict", json={ |
|
"data": [ |
|
f"data:image/png;base64,{image}==", |
|
]}).json() |
|
|
|
data = response["data"][0] |
|
return image |
|
iface = gr.Interface(fn=function, inputs="text", outputs="text") |
|
iface.launch() |