File size: 821 Bytes
018dcb2
31be0eb
267e0b0
7d73f46
31be0eb
018dcb2
166561c
 
31be0eb
 
 
 
 
 
 
 
 
377f73f
6e87ead
018dcb2
e35eea7
 
 
 
267e0b0
e35eea7
efaafff
31be0eb
018dcb2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
    # image = base64.b64encode(image).decode('utf-8')

    # 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()