djeddi-yacine / brain_fusion

A new package to generate images with AI
https://pub.dev/packages/brain_fusion
BSD 3-Clause "New" or "Revised" License
38 stars 7 forks source link

Failed host lookup #29

Closed Mohamed-kamel-1994 closed 1 year ago

Mohamed-kamel-1994 commented 1 year ago

every time i'm trying to run Uint8List image = await ai.runAI(query, AIStyle.noStyle, Resolution.r1x1);

i get this error => throw createError(response, "Failed host lookup: '$host'"); // host : "api.fusionbrain.ai"

i did every step like the Example

KarlMathuthu commented 1 year ago

Please provide me your code you tried with.

Mohamed-kamel-1994 commented 1 year ago

Please provide me your code you tried with.

// note that i'm using getx // InternetConnectionChecker to check if ther is internet // the error in this line Uint8List image = await ai.runAI(query, AIStyle.noStyle, Resolution.r1x1);

// controller class `class MainController extends GetxController{

final TextEditingController textEditingController = TextEditingController(); final AI ai = AI();

RxList widgets = [].obs;

bool run = false;

Future generateImage() async { if (run == true) return; run = true;

bool result = await InternetConnectionChecker().hasConnection;

if(result == false) return;

String query = textEditingController.text;

textEditingController.clear();

widgets.add(Text(query));

Uint8List image = await ai.runAI(query, AIStyle.noStyle, Resolution.r1x1);

widgets.add(Image.memory(image));
run = false;

print("========== done ==============");

}

@override void dispose() { textEditingController.dispose(); super.dispose(); } } // view final controller = Get.put(MainController()); return Scaffold( body: SafeArea( child: Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, margin: const EdgeInsets.all(ValuesRes.v8), child: Column( children: [ Expanded( child: GetX( builder: (controller) => ListView( children: controller.widgets, ), )), TextFormField( controller: controller.textEditingController, minLines: ValuesRes.minLines, maxLines: ValuesRes.maxLines, style: Theme.of(context).textTheme.headlineMedium, decoration: InputDecoration( hintText: "hint".tr ), ), const SizedBox(height: ValuesRes.v8,), SizedBox( width: MediaQuery.of(context).size.width, child: ElevatedButton( onPressed: (){ controller.generateImage(); }, child: Text("generate".tr)), ) ], ), ) ), ); `

KarlMathuthu commented 1 year ago

Please update your package to the latest version

brain_fusion: ^0.1.1

After this please let me know if you getting an error. Thanks.

Mohamed-kamel-1994 commented 1 year ago

Please update your package to the latest version

brain_fusion: ^0.1.1

After this please let me know if you getting an error. Thanks.

I already use it

get: ^4.6.5 brain_fusion: ^0.1.1 lottie: ^2.6.0 url_launcher: ^6.1.12 internet_connection_checker: ^1.0.0+1

I tried the app on the emulator and on a real device, but the same problem

Is it possible that the geographical location is the cause of the problem because I work from Kingdom of Saudi Arabia ?

KarlMathuthu commented 1 year ago

No, i don't think that's the problem. Let's see if that is the cause. Clone the example project that i put on this package and run it then share the video or the screenshots.

https://github.com/dj-yacine-flutter/brain_fusion/tree/master/example

Mohamed-kamel-1994 commented 1 year ago

No, i don't think that's the problem. Let's see if that is the cause. Clone the example project that i put on this package and run it then share the video or the screenshots.

https://github.com/dj-yacine-flutter/brain_fusion/tree/master/example

the same error

/// The [_generate] function to generate image data. Future<Uint8List> _generate(String query) async { /// Call the runAI method with the required parameters. Uint8List image = await _ai.runAI( query, AIStyle.anime, Resolution.r1x1, ); return image; }

Screenshot 2023-08-18 203218 Screenshot 2023-08-18 203353 Untitle8888d

KarlMathuthu commented 1 year ago

add in android/app/src/main/AndroidManifest.xml and then turn off your emulator then start it again. Hope this helps.

Mohamed-kamel-1994 commented 1 year ago

add in android/app/src/main/AndroidManifest.xml and then turn off your emulator then start it again. Hope this helps.

what shoud i add !!

Mohamed-kamel-1994 commented 1 year ago

add in android/app/src/main/AndroidManifest.xml and then turn off your emulator then start it again. Hope this helps.

this is AndroidManifest from my app what do you suggests to do

Screenshot 2023-08-18 230200