Spaces:
Runtime error
Runtime error
File size: 1,875 Bytes
e71614a 076601e e71614a a5c6829 e71614a 0faabca e71614a ebe3c16 e71614a 076601e e71614a 920bc28 e71614a b2dbd13 e71614a b2dbd13 |
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 |
import gradio as gr
import spaces
from texify.inference import batch_inference
from texify.model.model import load_model
from texify.model.processor import load_processor
from PIL import Image
title="""# 🙋🏻♂️Welcome to🌟Tonic's👨🏻🔬Texify"""
description="""You can upload a picture with a math formula and this model will return latex formulas. Texify is a multimodal input model. You can use this Space to test out the current model [vikp/texify2](https://huggingface.co/vikp/texify2) You can also use vikp/texify2🚀 by cloning this space. Simply click here: [Duplicate Space](https://huggingface.co/spaces/Tonic1/texify?duplicate=true)
Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder's🛠️community 👻 [](https://discord.gg/GWpVpekp) On 🤗Huggingface: [TeamTonic](https://huggingface.co/TeamTonic) & [MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to 🌟 [DataTonic](https://github.com/Tonic-AI/DataTonic) 🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
"""
model = load_model()
processor = load_processor()
@spaces.GPU
def process_image(img):
# img = Image.fromarray(img)
results = batch_inference([img], model, processor)
return '\n'.join(results) if isinstance(results, list) else results
with gr.Blocks() as app:
gr.Markdown(title)
gr.Markdown(description)
with gr.Row():
with gr.Column():
image_input = gr.Image(type="pil")
with gr.Column():
output = gr.Textbox()
image_input.change(process_image, inputs=image_input, outputs=output)
if __name__ == "__main__":
app.launch() |