Spaces:
Runtime error
Runtime error
Update app.py
Browse files316 unmodified lines317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361316 unmodified lines"""# Gradio Interfacedef app():df = format_salesforce_data()table_component = Nonebar_graph_component = Noneif df is not None:table_component = df.to_html(index=False)bar_graph_image = generate_bar_graph(df)if bar_graph_image:bar_graph_component = bar_graph_imagereturn gr.TabbedInterface([gr.Interface(fn=process_image,inputs=[gr.Image(type="numpy", label="Upload Image"),gr.Dropdown(label="Mode", choices=["Entry", "Exit"], value="Entry"),gr.Radio(label="Entry Type", choices=["Sales", "Non-Sales"], value="Sales"),gr.Number(label="Quantity", value=1, interactive=True),],outputs=[gr.Text(label="Image Data Viewer"),gr.Text(label="Result")],title="Salesforce Export",description="Upload an image, select Entry/Exit mode and Sales/Non-Sales type, and specify quantity."),gr.Interface(fn=lambda: (table_component, bar_graph_component),inputs=[],outputs=[gr.HTML(label="Salesforce Data Table"),gr.Image(type="pil", label="Stock Distribution Bar Graph")],title="Salesforce Data",description="View structured Salesforce data as a table and bar graph.")], ["Processing", "Salesforce Data"])if __name__ == "__main__":app().launch(share=True)316 unmodified lines317318319320321322323324325326327316 unmodified lines"""The HTML code in your script under the camera_html variable is a standalone HTML page. However, this HTML code does not directly integrate with the Gradio interface in your Python application.Why the camera_html code won't work as-is:Gradio and HTML: Gradio is designed to build interfaces using Python objects like gr.Interface. It does not directly interpret raw HTML code in the way a traditional web server would.JavaScript Execution: The <script src="camera.js"></script> in your camera_html will not run as part of the Gradio application because Gradio does not serve static files (like camera.js) or allow embedding custom JavaScript directly.if __name__ == "__main__":app().launch(share=True)
app.py+5-39