Skip to content
Snippets Groups Projects
Commit 3a70053b authored by BIRK Renaud's avatar BIRK Renaud
Browse files

feat: API GET /render

parent c33f8bb7
No related branches found
No related tags found
No related merge requests found
......@@ -2,5 +2,17 @@ import os
from gradio_client import Client, handle_file
class RenderController:
def get_render(self, hf_token='') -> str:
def get_render(self, hf_token='', text="Hello!!",
selected_model="Model 1 (Turbo Realism)") -> str:
client = Client("Jonny001/Text-to-Image")
result = client.predict(
text=text,
selected_model=selected_model,
api_name="/generate_images"
)
print(result)
return "Hello, World!"
......@@ -13,6 +13,7 @@ suggest_controller = SuggestController()
def setup_routes(app):
@app.route('/glb', methods=['GET'])
# Image to model
def get_glb():
base_image_url = request.args.get('base_image_url', type=str)
hf_token = request.args.get('hf_token', '', type=str)
......@@ -29,12 +30,16 @@ def setup_routes(app):
slat_sampling_steps, multiimage_algo,
mesh_simplify, texture_size)
# Text to image
@app.route('/render', methods=['GET'])
def get_render():
hf_token = request.args.get('hf_token', '', type=str)
text = request.args.get('text', 'Hello!!', type=str)
selected_model = request.args.get('selected_model', 'Model 1 (Turbo Realism)', type=str)
return render_controller.get_render(hf_token)
return render_controller.get_render(hf_token, text, selected_model)
# Suggest
@app.route('/suggest', methods=['GET'])
def get_suggest():
hf_token = request.args.get('hf_token', '', type=str)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment