Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	File size: 718 Bytes
			
			| 864964a | 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 | import gradio as gr
import requests
import json
def text_gen(url, prompt):
    headers = {'Content-Type': 'application/json'}
    payload = {'inputs': prompt, 'parameters': {'max_new_tokens': 32}}
    resp = requests.post(url, data=json.dumps(payload), headers=headers)
    return resp.text
URL = "198.175.88.247"
myport = "80"
g2url = f"http://{URL}:{myport}/generate"
url_input = gr.Textbox(label="URL", value=g2url, visible=True)
prompt_input = gr.Textbox(label="Prompt", value="Why is the sky purple?", visible=True)
outputs = gr.Textbox(label="Generated Text")
demo = gr.Interface(
    fn=text_gen,
    inputs=[url_input, prompt_input],
    outputs=[outputs],
    title="Text Generation Demo"
)
demo.launch() | 
