import gradio as gr import json from bark import SAMPLE_RATE, generate_audio, preload_models from bark.generation import SUPPORTED_LANGS #from share_btn imposrt community_icon_html, loading_icon_html, share_js from flask import Flask, jsonify DEBUG_MODE = False EXAMPLES = [ ["Hello, my name is Suno. And, uh — and I like pizza. [laughs]\nBut I also have other interests such as playing tic tac toe."] ] def endpoint1(): # Your logic for the first endpoint #return jsonify({"message": "Endpoint 1"}) return "Endpoint 1" def echo(text, request: gr.Request): output_text = {"report1": "SUCCESS"} # Initialize as a dictionary output_text["your_text"] = text if request: # Convert headers to a dictionary and include them in the output_text output_text["headers"] = dict(request.headers.items()) output_text[""] output_text_json = json.dumps(output_text) return output_text_json io = gr.Interface( fn = echo, inputs = "textarea", outputs = "json" ).launch(share=True)