Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from datasets import load_dataset | |
| from transformers import CLIPTokenizerFast, CLIPProcessor, CLIPModel | |
| import torch | |
| from tqdm.auto import tqdm | |
| import numpy as np | |
| import time | |
| def CLIP_model(): | |
| global model, token, processor | |
| model_id = 'openai/clip-vit-base-patch32' | |
| model = CLIPModel.from_pretrained(model_id) | |
| token = CLIPTokenizerFast.from_pretrained(model_id) | |
| processor = CLIPProcessor.from_pretrained(model_id) | |
| def hello_name(name): | |
| return "Hello " + name | |
| def main(): | |
| CLIP_model() | |
| iface = gr.Interface(fn = hello_name, inputs = "text", outputs = "text") | |
| iface.launch(inline = False) | |
| if __name__ == "__main__": | |
| main() |