Spaces:
Sleeping
Sleeping
File size: 1,640 Bytes
903b6b9 |
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
import gradio as gr
from gradio_client import Client
MESAGE_HEADER = """
# API Demo (Client component)
Welcome to my simple demonstration of the gradio potential as an API.
It is made of 2 components: *API_demo_server* and *API_demo_client*.
Server component: [Nuno-Tome/API_demo_server](Nuno-Tome/aPI_demo_server)
Client component: [Nuno-Tome/API_demo_client](Nuno-Tome/aPI_demo_client)
**Just write you message and watch it be returned by the server.**
"""
MESAGE_BMC = """
## If you want to support me, you can buy me a coffee:
[](https://www.buymeacoffee.com/nunotome)
"""
# Print the message header for "By me a coffee" link
def print_bmc():
bmc_link = "https://www.buymeacoffee.com/nuno.tome"
image_url = "https://helloimjessa.files.wordpress.com/2021/06/bmc-button.png?w=" # Image URL
#image_size = "150px" # Image size
#image_link_markdown = f"[]({bmc_link})"
image_link_markdown = "[]({bmc_link})"
gr.Markdown("""
[]({bmc_link})
""")
# Buy me a Coffee Setup
client = Client("Nuno-Tome/API_demo_server")
DEBUG_MODE = True
def request(text):
gr.Markdown(
"""
# Hello World!
Start typing below to see the output.
""")
result = client.predict(
text,
api_name="/predict"
)
return result
demo = gr.Interface(fn=request, inputs="textbox", outputs="json")
demo.launch(share=True) |