How do I run HF space in Flutter?
I am developing an application for android with Flutter, I was able to integrate the embed code provided by HF space into the application. However, I get an error in the image upload section, how can I solve this problem?Flutter Code:import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class PageTwo extends StatefulWidget {
  const PageTwo({Key? key}) : super(key: key);

  @override
  State<PageTwo> createState() => _HuggingfaceSpaceViewerState();
}

class _HuggingfaceSpaceViewerState extends State<PageTwo> {
  late final WebViewController controller;

  @override
  void initState() {
    super.initState();
    controller = WebViewController()
      ..setJavaScriptMode(JavaScriptMode.unrestricted)
      ..setBackgroundColor(const Color(0xFF000000))
      ..setNavigationDelegate(
        NavigationDelegate(
          onProgress: (int progress) {
          },
          onPageStarted: (String url) {
          },
          onPageFinished: (String url) {
          },
          onWebResourceError: (WebResourceError error) {
          },
          onNavigationRequest: (NavigationRequest request) {
            return NavigationDecision.navigate;
          },
        ),
      )
      ..loadRequest(Uri.parse('https://huggingfacem4-idefics3.hf.space'));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Huggingface Space'),
      ),
      body: WebViewWidget(controller: controller),
    );
  }
}Error when I try to upload an image: E/FrameEvents(30325): updateAcquireFence: Did not find frame.image1199×2526 78 KB
2024-09-24T22:22:34Z
Perhaps:stackoverflow.comGoogle maps flutter issues -updateAcquireFence: Did not find frame. & Expecting binder but got nullflutter, mapsasked byVinicius Dreheron10:47PM - 21 May 24 UTC
2024-09-26T17:53:01Z
@John6666Thank you for the response, but unfortunately, it didn’t solve my problem.
2024-09-26T19:27:08Z
Then it is a question of the means of using HF’s space externally. As it turns out, it should be possible. Many people are doing it.You could call the functions visible in the Use via API at the bottom of the page (although the auto-generated description contains some lies), or you could scrape and grab the Gradio component and request it, which would be more reliable.I’m not very familiar with scraping pages using JS, but the resulting code didn’t seem difficult. There may be some information in the forum logs.
2024-09-27T07:27:10Z
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.