david167 commited on
Commit
0460f5e
·
1 Parent(s): 02333f2

DIRECT CONTENT API: Return just the generated content, no API wrappers or tuples - perfect for client parsing

Browse files
Files changed (1) hide show
  1. gradio_app.py +9 -9
gradio_app.py CHANGED
@@ -179,15 +179,15 @@ def api_respond(message, history, temperature, json_mode=None, template=None):
179
 
180
  # ABSOLUTE SIMPLEST INTERFACE - NO JSON, NO STATE, NOTHING FANCY
181
  def simple_api(message, history_str, temperature, json_mode, template):
182
- """Ultra-simple wrapper that converts string history to list"""
183
  try:
184
- # Convert string history to empty list (Gradio compatibility)
185
- history = []
186
- result = api_respond(message, history, temperature, json_mode, template)
 
 
 
187
 
188
- # Convert the result to string format for simple text output
189
- import json
190
- return json.dumps(result[0], indent=2), result[1]
191
  except Exception as e:
192
  logger.error(f"Simple API Error: {e}")
193
  return f"Error: {e}", ""
@@ -205,8 +205,8 @@ demo = gr.Interface(
205
  gr.Textbox(label="API Response", lines=10), # Simple text output
206
  gr.Textbox(label="Status", visible=False)
207
  ],
208
- title="🚀 Question Generation API - ULTRA SIMPLE",
209
- description="The simplest possible API interface. Just works.",
210
  api_name="respond"
211
  )
212
 
 
179
 
180
  # ABSOLUTE SIMPLEST INTERFACE - NO JSON, NO STATE, NOTHING FANCY
181
  def simple_api(message, history_str, temperature, json_mode, template):
182
+ """Ultra-simple wrapper - returns JUST the content for easy client parsing"""
183
  try:
184
+ # Generate the response directly
185
+ response_content = generate_response(message, temperature)
186
+
187
+ # Return JUST the content - no API wrapper, no tuples, just the actual response
188
+ logger.info(f"Returning direct content: {len(response_content)} chars")
189
+ return response_content, ""
190
 
 
 
 
191
  except Exception as e:
192
  logger.error(f"Simple API Error: {e}")
193
  return f"Error: {e}", ""
 
205
  gr.Textbox(label="API Response", lines=10), # Simple text output
206
  gr.Textbox(label="Status", visible=False)
207
  ],
208
+ title="🚀 Question Generation API - DIRECT CONTENT",
209
+ description="Returns content directly - no wrappers, no complications. Perfect for client integration.",
210
  api_name="respond"
211
  )
212