import openai import gradio as gr openai.api_key = "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" def convert_text_to_structured(text): prompt = f"Unstructured medical notes:\n\"{text}\"\nStructured format:\n1. Patient Information:\n2. Chief Complaint:\n3. Medical History:\n4. Physical Examination Findings:\n5. Diagnostic Tests:\n6. Diagnosis:\n7. Treatment:\n8. Disposition:\n" response = openai.Completion.create( engine="gpt-3.5-turbo-instruct", prompt=prompt, max_tokens=300 ) structured_data = response["choices"][0]["text"] return structured_data def convert_text(input_text): return convert_text_to_structured(input_text) iface = gr.Interface(fn=convert_text, inputs="text", outputs="text") iface.launch(share=True)